import request from "@/utils/request";

const api_name = "login";

// 登录方法
export const login = (username, password, verifyCode, verifyCodeUUID) => {
  const data = {
    username,
    password,
    verifyCode,
    verifyCodeUUID,
  };
  return request({
    url: `${api_name}/login`,
    method: "post",
    headers: {
      isToken: false,
    },
    data,
  });
};

// 退出方法
export const logout = () => {
  return request({
    url: `${api_name}/logout`,
    method: "post",
  });
};

// 获取登陆方式
export const getCaptchaMode = () => {
  return request({
    url: `${api_name}/captchaMode`,
    method: "get",
  });
};

// 获取验证码
export const getCodeImg = () => {
  return request({
    url: `${api_name}/captcha`,
    method: "get",
    timeout: 20000,
  });
};

// 获取路由
export const getRouters = () => {
  return request({
    url: `${api_name}/getRouters`,
    method: "get",
  });
};
